<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
  <style>
    /* 必需 */
    .expand-transition {
      transition: all .3s ease;
      height: 30px;
      padding: 10px;
      background-color: #eee;
      overflow: hidden;
    }

    /* .expand-enter 定义进入的开始状态 */
    /* .expand-leave 定义离开的结束状态 */
    .expand-enter, .expand-leave {
      height: 0;
      padding: 0 10px;
      opacity: 0;
    }
  </style>
</head>
<body>
<script src="vue.js"></script>
<div v-if="show" transition="expand">hello</div>
<div v-show="ok" class="animated" transition="bounce">Watch me bounce</div>
<div id="app">
  <div>{{name}}</div>
  <ul>
    <li v-for="todo in todos">
      {{ todo.text }}
    </li>
  </ul>
  <input v-model="age" number>
</div>
<script>

  var vue = new Vue({
    el: '#app',
    data: {
      name: 'xutao',
      age: 1,
      todos: [
        {text: 'Learn JavaScript'},
        {text: 'Learn Vue.js'},
        {text: 'Build Something Awesome'}
      ]
    },
    methods: {
      setName: function (name) {
        this.name = name;
      }
    }
  });
  setTimeout(function () {
    vue.setName('taox');
  }, 1000);
  Vue.transition('bounce', {
    enterClass: 'bounceInLeft',
    leaveClass: 'bounceOutRight'
  })
  Vue.transition('expand', {

    beforeEnter: function (el) {
      el.textContent = 'beforeEnter'
    },
    enter: function (el) {
      el.textContent = 'enter'
    },
    afterEnter: function (el) {
      el.textContent = 'afterEnter'
    },
    enterCancelled: function (el) {
      // handle cancellation
    },

    beforeLeave: function (el) {
      el.textContent = 'beforeLeave'
    },
    leave: function (el) {
      el.textContent = 'leave'
    },
    afterLeave: function (el) {
      el.textContent = 'afterLeave'
    },
    leaveCancelled: function (el) {
      // handle cancellation
    }
  })
</script>
</body>
</html>
